{% extends "base.html" %}

{% comment %}
<!--
  Copyright (C) 2010 ZHENG Zhong <http://www.zhengzhong.net/>
  Created on 2010-04-29.
  $Id$
-->
{% endcomment %}

{% load friday_extra %}

{#________________________________________________________________________________________________#}

{% block html_title %} Notifications {% endblock %}

{#________________________________________________________________________________________________#}

{% block main %}

  <div class="section">
    <h1>
      Notifications
      {% if category %}
        in category "{{ category|escape }}"
      {% endif %}
      ...
    </h1>
  </div>

  <div class="section">

    <form action="{% url friday.delete_notifications %}" method="POST">

      <table class="table">

        <thead>
          <tr>
            <th style="width: 1%;"></th>
            <th><span class="nowrap">Subject</span></th>
            <th><span class="nowrap">Author</span></th>
            <th><span class="nowrap">Recipients</span></th>
            <th><span class="nowrap">Send date</span></th>
            <th><span class="nowrap">Category</span></th>
          </tr>
        </thead>

        <tbody>

          {% for notification in notifications %}

            <tr>
              <td><input type="checkbox" name="notification_id" value="{{ notification.id }}"/></td>
              <td>
                <div class="big nowrap">
                  <a href="{% url friday.view_notification notification_id=notification.id %}">
                    {{ notification.subject|escape }}
                  </a>
                </div>
              </td>
              <td>
                <div class="nowrap">
                  <a href="{% url friday.view_profile username=notification.author.username %}">
                    {{ notification.author|escape }}
                  </a>
                </div>
              </td>
              <td><div class="nowrap">{{ notification.recipients|length }}</div></td>
              <td><div class="nowrap">{{ notification.send_date|prettify_datetime }}</div></td>
              <td>
                <div class="nowrap">
                  <a href="{% url friday.view_notifications category=notification.category %}">
                    {{ notification.category|escape }}
                  </a>
                </div>
              </td>
            </tr>

          {% endfor %}

        </tbody>

      </table>

      <div class="field">
        <input class="button" type="submit" value="Delete selected notifications"/>
      </div>

      {% if category %}
        <div class="table-info">
          <a href="{% url friday.view_notifications %}">&raquo; View all notifications</a>
        </div>
      {% endif %}

    </form>

  </div>

{% endblock %}



